package com.riadeveloper.UI
{
	import com.greensock.*;
	import com.greensock.easing.*;
	
	import flash.display.Bitmap;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.geom.Point;
	
	public class ImageContainer extends Sprite
	{
		public var imgShowPor:String='';
		public var bitmap:Bitmap;
		public var imagePosX:Number = 0;
		public var imagePosY:Number = 0;
		public var imageNewPosX:Number = 0;
		public var imageNewPosY:Number = 0;

		public override function set width(value:Number):void
		{
			imgMask.width = value ;
		}
		public override function get width():Number
		{
			return imgMask.width ;
		}
		public override function set height(value:Number):void
		{			
			imgMask.height = value ;
		}
		public override function get height():Number
		{
			return imgMask.height ;
		}
		public var imgMask:Shape = new Shape();
		public var img:Sprite = new Sprite();
		
		public  function open(scale:Number):void
		{
			TweenMax.to(bitmap,.78,{scaleY:scale,scaleX:scale,x:imageNewPosX,y:imageNewPosY,ease:Cubic.easeOut});
		}
		public  function close():void
		{
			TweenMax.to(bitmap,.78,{scaleY:1,scaleX:1,x:imagePosX,y:imagePosY,ease:Cubic.easeOut});
		}

		public  function get scale():Number
		{
			return bitmap.scaleX ;
		}

		public function ImageContainer()
		{
			addChild(imgMask);
			addChild(img);
			img.mask = imgMask;
			super();
		}
		public function createMask(_width:Number,_height:Number):void
		{
			imgMask.graphics.beginFill(0xFFFFFF);
			imgMask.graphics.drawRoundRectComplex( 0,0,_width,_height,0,0,0,0);
			imgMask.graphics.endFill();
		}
	}
}